home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Personal Computer World 2009 February
/
PCWFEB09.iso
/
Software
/
Resources
/
Chat & Communication
/
Digsby build 37
/
digsby_setup.exe
/
lib
/
linecache.pyo
(
.txt
)
< prev
next >
Wrap
Python Compiled Bytecode
|
2008-10-13
|
3KB
|
128 lines
# Source Generated with Decompyle++
# File: in.pyo (Python 2.5)
import sys
import os
__all__ = [
'getline',
'clearcache',
'checkcache']
def getline(filename, lineno, module_globals = None):
lines = getlines(filename, module_globals)
if lineno <= lineno:
pass
elif lineno <= len(lines):
return lines[lineno - 1]
else:
return ''
cache = { }
def clearcache():
global cache
cache = { }
def getlines(filename, module_globals = None):
if filename in cache:
return cache[filename][2]
else:
return updatecache(filename, module_globals)
def checkcache(filename = None):
if filename is None:
filenames = cache.keys()
elif filename in cache:
filenames = [
filename]
else:
return None
for filename in filenames:
(size, mtime, lines, fullname) = cache[filename]
if mtime is None:
continue
try:
stat = os.stat(fullname)
except os.error:
del cache[filename]
continue
if size != stat.st_size or mtime != stat.st_mtime:
del cache[filename]
continue
def updatecache(filename, module_globals = None):
if filename in cache:
del cache[filename]
if not filename or filename[0] + filename[-1] == '<>':
return []
fullname = filename
try:
stat = os.stat(fullname)
except os.error:
msg = None
basename = os.path.split(filename)[1]
if module_globals and '__loader__' in module_globals:
name = module_globals.get('__name__')
loader = module_globals['__loader__']
get_source = getattr(loader, 'get_source', None)
if name and get_source:
if basename.startswith(name.split('.')[-1] + '.'):
try:
data = get_source(name)
except (ImportError, IOError):
pass
if data is None:
return []
cache[filename] = ([], [], [ line + '\n' for line in data.splitlines() ], fullname)
return cache[filename][2]
for dirname in sys.path:
try:
fullname = os.path.join(dirname, basename)
except (TypeError, AttributeError):
continue
try:
stat = os.stat(fullname)
continue
except os.error:
continue
else:
return []
except:
None<EXCEPTION MATCH>os.error
try:
fp = open(fullname, 'rU')
lines = fp.readlines()
fp.close()
except IOError:
msg = None
return []
size = stat.st_size
mtime = stat.st_mtime
cache[filename] = (size, mtime, lines, fullname)
return lines